package com.hxd.otc.module.my.presenter;

import com.hxd.otc.base.BaseBean;
import com.hxd.otc.module.my.contract.AccountContract;
import com.hxd.otc.module.my.model.UserModel;
import com.hxd.otc.mvp.base.BasePresenter;
import com.hxd.otc.net.BaseObserver;

/**
 * Created by lzy on 2018/6/11 0011.
 * description ${用户信息Presenter}
 */
public class AccountInfoPresenter extends BasePresenter<AccountContract.View> implements AccountContract.Presenter {

    UserModel mUserModel;

    public AccountInfoPresenter(AccountContract.View view) {
        super(view);
        mUserModel = UserModel.getInstance();
    }

    @Override
    public void logout() {
        mUserModel.logout(new BaseObserver<BaseBean>() {
            @Override
            public void onNext(String msg, BaseBean o) {

                mView.logoutSucceed();
            }

            @Override
            public void onError(int errType, String errMessage) {
                mView.logoutFail(errMessage);
            }

        }, mView.<BaseBean>bindAutoDispose());
    }
}
